home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 878 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: cscsun3.larc.nasa.gov!hook
  2. From: hook@cscsun3.larc.nasa.gov (Ed Hook)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Q.: How does strtol() handles overflows?
  5. Date: 9 Jan 1996 21:20:14 GMT
  6. Organization: CSC/NASA Langley Research Center
  7. Distribution: world
  8. Message-ID: <4cum6e$6st@reznor.larc.nasa.gov>
  9. References: <4cuc2h$gup@news.netvision.net.il>
  10. Reply-To: hook@cscsun3.larc.nasa.gov
  11. NNTP-Posting-Host: cscsun3.larc.nasa.gov
  12.  
  13. In article <4cuc2h$gup@news.netvision.net.il>, simchoni@netvision.net.il (Ami Simchoni) writes:
  14. |> Hi,
  15. |> 
  16. |> I am trying to make a rubust ascii-to-decimal function which handles 
  17. |> input errors and overflows. I want to rely on the standard library as 
  18. |> much as possible.
  19. |> 
  20. |> Borland C++ 3.1 and 4.02 doumentation says if an overflow occurs strtol 
  21. |> just returns zero - which is not satisfactory, of course.
  22. |> 
  23. |> The BC++3.1 library source which I have, however, sets errno to ERANGE 
  24. |> and returns LONG_MIN or LONG_MAX on overflow. This appears both in the 
  25. |> code and in the comments.
  26. |> 
  27. |> Does anybody know what the standard says about it?
  28. |>
  29.   The Standard requires the behavior that you discovered in the source
  30.   for the library.
  31.  
  32. |> Thanks,
  33. |> Uri. 
  34. |> 
  35.  
  36. -- 
  37.  Ed Hook                              |       Coppula eam, se non posit
  38.  Computer Sciences Corporation        |         acceptera jocularum.
  39.  NASA Langley Research Center         | Me? Speak for my employer?...<*snort*>
  40.  Internet: hook@cscsun3.larc.nasa.gov |        ... Get a _clue_ !!! ...
  41.